<template>
  <el-card style="width: 700px; height: 200px">
    <h3>记录</h3>
    <div id="myChart" style="width: 700px; height: 200px; margin-top: 0; padding: 0"></div>
  </el-card>
</template>

<script>
export default {
  name: 'home-learning-records-card',
  data () {
    return {
      data: ''
    }
  },
  methods: {
    getCharts () {
      const myChart = this.$echarts.init(document.getElementById('myChart'))
      const option = {
        grid: {
          top: '8%',
          left: '4%',
          right: '6%',
          bottom: '40%'
        },
        xAxis: {
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {},
        series: [
          {
            type: 'line',
            data: [23, 24, 18, 25, 27, 28, 25]
          }
        ]
      }
      myChart.setOption(option)
      // 根据页面大小自动响应图表大小
      window.addEventListener('resize', function () {
        myChart.resize()
      })
    }
  },
  mounted () {
    this.getCharts()
  }

}
</script>

<style scoped>

</style>
